<template>
    <section class="page">
      <headerbar>会议发起通知</headerbar>

      <section class="inner-content">

        <div class="input-column-wrap">
          <div class="name"><i class="required color-red">*</i>通知标题：</div>
          <input v-model="data.title" type="text" placeholder="请输入通知标题">
        </div>

        <div class="text-block">
          <div class="name color-default input-name"><i class="required color-red"></i>&nbsp;&nbsp;&nbsp;接收反馈：</div>
          <div class="value flex-between">
            <span></span>
            <div class="flex" style="width:10em;white-space: nowrap;"><inputNumber :defaultNumber="0.5" :minNumber="0" :step="0.5" :maxNumber="100" v-model="data.laterHourFeedback"></inputNumber><span class="no-wrap"><i class="pdh-3"></i>小时后</span></div>
            </div>
        </div>

        <div class="input-column-wrap">
          <div class="name"><i class="required color-red">*</i>通知内容：</div>
          <div></div>
        </div>
        <div class="input-row-wrap">
          <textarea rows="8" v-model="data.nodeMsg" type="text" placeholder="请输入通知内容"></textarea>
        </div>
        <div class="input-row-wrap pdh-5">
          <div class="value color-tip">说明：{{data.explanation}}</div>
        </div>

        <!--
        <div class="text-block">
          <div class="name color-default input-name"><i class="required color-red">*</i>通知标题：</div>
          <div class="value"><input v-model="data.title" type="text" placeholder="请输入通知标题"></div>
        </div>
        <div class="text-block">
          <div class="name color-default input-name"><i class="required color-red">*</i>通知内容：</div>
          <div class="value"><textarea rows="8" v-model="data.nodeMsg" type="text" placeholder="请输入通知内容"></textarea></div>
        </div>
        <div class="text-block">
          <div class="name color-default input-name">说明：</div>
          <div class="value">{{data.explanation}}</div>
        </div>-->

        <div class="mgt-10"></div>
        <div @click="goNotice()" class="default-block-btn pdh-5">确定通知</div>
        <div @click="cancel()" class="default-block-btn pdh-5">取消通知</div>
        <div class="mgt-10"></div>
      </section>
    </section>
</template>

<script>
  import tools from '@/utils/tools'
  import api from '@/common/config/api'
  import loginService from '@/service/loginService'
  import moment from 'moment'
  import fileIcon from '../../../../static/images/up_document.png'
  import inputNumber from '@/components/common/inputNumber'
  export default {
    components: {inputNumber},
    name: 'sendNotice',
    data () {
      return {
        fn: tools,
        data: {
          title: '',
          nodeMsg: '',
          explanation: '',
          orgLifeId: '',
          laterHourFeedback: ''
        }
      }
    },
    created () {
      this.data = this.$store.state.organizationalLifeAdd
      console.log("organizationalLifeAdd={}", this.$store.state.organizationalLifeAdd)
      console.log("data={}", this.data)
    },
    methods: {
      goNotice () {
        if (this.data.title === '') {
          return tools.tip('请输入通知标题！')
        }
        if (this.data.content === '') {
          return tools.tip('请输入通知内容！')
        }
        let _this = this
        this.$createDialog({
          type: 'confirm',
          icon: '',
          title: '温馨提示',
          content: '确认通知内容，是否进行发送？',
          confirmBtn: {
            text: '确定',
            active: true,
            disabled: false,
            href: 'javascript:;'
          },
          cancelBtn: {
            text: '取消',
            active: false,
            disabled: false,
            href: 'javascript:;'
          },
          onConfirm: () => {
            _this.submit()
          },
          onCancel: () => {
          }
        }).show()
      },
      submit () {
        let data = {
          loginId: '3750',
          orgInfoId: this.data.orgLifeId,
          title: this.data.title || '',
          nodeMsg: this.data.nodeMsg,
          laterHourFeedback: this.data.laterHourFeedback
        }
        loginService.optSendNodeMsg(data).then((res) => {
          if (res.code === 0) {
            // tools.tip('通知成功')
            // tools.back()
            this.showDialog()
          } else {
            tools.tip(res.message)
          }
        })
      },
      showDialog () {
        let me = this
        this.$createDialog({
          type: 'alert',
          icon: '',
          title: '温馨提示',
          content: '会后5个工作日内需添加图片等资料会议才有效',
          confirmBtn: {
            text: '确定',
            active: true,
            disabled: false,
            href: 'javascript:;'
          },
          onConfirm: () => {
            tools.tip('通知成功')
            tools.back()
          }
        }).show()
      },
      cancel () {
        tools.back()
      }
    }
  }
</script>

<style scoped>

</style>
